import { defineStore } from 'pinia'
export const useOrderFromStore = defineStore('orderFrom', () => {
  const model = JSON.stringify({
    fileNames: {},
    firstFormField: {
      infoType: null,
      infoLevel: null,
      newOld: null,
      sourceType: null,
      newsForwardRemark: null,
      memo: null
    },
    twoFormField: {
      title: null,
      content: null,
      relatedEnterpriseList: null,
      relatedUserList: null,
      author: null,
      fans: null,
      url: null,
      attachmentList: [],
      publishTimeMillis: '',
      forwardCount: null,
      commentCount: null,
      thumbsCount: null,
      plyCount: null,
      viewCount: null
    }
  })
  const formInfo = reactive({
    ...JSON.parse(model)
  })
  function resetState() {
    Object.assign(formInfo, { ...JSON.parse(model) })
  }

  return {
    formInfo,
    resetState
  }
})
